<% if @comment.valid? %>
  var mcomment = $('#comments <%= @comment.indexno %>').eq(0);
  mcomment.before("<%= j render('features/comment', comment: @comment) %>");
  mcomment.remove();

  // 清除编辑区
  $('#editor').val('');
  $('#content_html').val('');
  // 清除回复状态
  $("#comment_reply_id").val('');
  // 隐藏错误提示
  $('#error-tips').css("display", "none");

  // 还原至新建评论的状态
  $('#via_method').remove();
  var form = $('#comment_form form');
  form.attr('action', '<%= comments_path %>');
  $('#post-btn').text('<%= t("comment.post") %>');

<% else %>
  $('#error-tips').css("display", "block");
  $('#error-tips #error-msg').text("<%= @comment.errors.full_messages[0] %>");
<% end %>
